
const mixinFromInspectionAttributes = {
  data() {
    return {
      changeLock: false,
      option: {
        height: 'calc(100vh - 500px)',
        calcHeight: 30,
        menuWidth: 200,
        tip: false,
        tree: true,
        viewBtn: false,
        editBtn: false,
        delBtn: false,
        addBtn: false,
        lazy: true, // 懒加载
        searchShow: true,
        labelWidth: 155,
        searchLabelWidth: 130,
        searchMenuSpan: 18,
        searchMenuPosition: 'right',
        border: true,
        index: true,
        indexLabel: '序号',
        selection: false,
        dialogClickModal: false,
        columnBtn: false,
        column: []
      },
      categoryColumn: [
        {
          label: '序号',
          prop: 'dataIndex',
          fixed: true,
          display: false
        },
        {
          label: '物料类别编码',
          prop: 'objectNo',
          search: true,
          order: 1,
          type: 'tree',
          dicUrl: '/api/mes-admin/part-category/tree',
          props: {
            label: 'code',
            value: 'code'
          },
          rules: [
            {
              required: true,
              message: '请输入物料类别编码',
              trigger: 'blur'
            },
            {
              max: 15,
              message: '编码最多输入15个字符'
            }
          ]
        },
        {
          label: '物料类别名称',
          prop: 'objectName',
          search: true,
          order: 2,
          type: 'tree',
          dicUrl: '/api/mes-admin/part-category/tree',
          props: {
            label: 'title',
            value: 'title'
          },
          rules: [
            {
              required: true,
              message: '请输入物料类别名称',
              trigger: 'blur'
            },
            {
              max: 15,
              message: '名称最多输入15个字符'
            }
          ]
        },
        {
          label: '描述',
          prop: 'remark',
          type: 'textarea',
          maxRows: 3,
          minRows: 3,
          maxlength: 200,
          showWordLimit: true
        },
        {
          label: '检验方式',
          prop: 'inspectionMode',
          type: 'select',
          search: true,
          dicData: [
            {
              label: '免检',
              value: 'EXEMPTION'
            },
            {
              label: '抽检',
              value: 'SAMPLING'
            },
            {
              label: '全检',
              value: 'FULLINSPECTION'
            }
          ]
        },
        {
          label: '最低抽样数量',
          prop: 'minSamplingQuantity'
        },
        {
          label: '检验负责人',
          prop: 'principalName',
          search: true,
          type: 'search',
          appendClick: () => {
            this.openUserCommonModal('searchSelect');
          }
        },
        {
          label: 'AQL设置方案编码',
          prop: 'aqlSchemeCode',
          type: 'search',
          disabled: true,
          appendClick: () => {
            this.openAqlConfigModal();
          },
          rules: [
            {
              required: true,
              message: '请选择AQL设置方案编码',
              trigger: 'blur'
            }
          ]
        },
        {
          label: 'AQL设置方案名称',
          prop: 'aqlSchemeName'
        },
        {
          label: '是否已配置属性',
          prop: 'isConfig',
          type: 'select',
          search: true,
          dicData: [
            {
              label: '是',
              value: true
            },
            {
              label: '否',
              value: false
            }
          ]
        },
        {
          label: '更新人',
          prop: 'updateUserName'
        },
        {
          label: '更新时间',
          prop: 'updateTime'
        }
      ],
      partColumn: [
        {
          label: '物料类型',
          prop: 'partType',
          type: 'select',
          dicData: [
            {
              label: '成品',
              value: 'FINISHED'
            },
            {
              label: '半成品',
              value: 'SEMIFINISHED'
            },
            {
              label: '原料',
              value: 'MATERIAL'
            }
          ],
          order: 1,
          rules: [
            {
              required: true,
              message: '请输入物料类型',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '物料编码',
          prop: 'objectNo',
          search: true,
          order: 1,
          searchOrder: 1,
          rules: [
            {
              required: true,
              message: '请输入物料编码',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '物料名称',
          prop: 'objectName',
          search: true,
          order: 2,
          searchOrder: 2,
          rules: [
            {
              required: true,
              message: '请输入物料类别名称',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '版本',
          prop: 'revision',
          order: 2,
          rules: [
            {
              required: true,
              message: '请输入版本',
              trigger: 'blur'
            }
          ]
        },
        {
          label: '物料类别名称',
          prop: 'partCategoryName'
        },
        {
          label: '检验方式',
          prop: 'inspectionMode',
          type: 'select',
          search: true,
          dicData: [
            {
              label: '免检',
              value: 'EXEMPTION'
            },
            {
              label: '抽检',
              value: 'SAMPLING'
            },
            {
              label: '全检',
              value: 'FULLINSPECTION'
            }
          ],
          rules: [
            {
              required: true,
              message: '请选择检验方式',

              trigger: 'change'
            }
          ]
        },
        {
          label: '检验负责人',
          prop: 'principalName',
          search: true,
          hide: false,
          type: 'search',
          appendClick: () => {
            this.openUserCommonModal('searchSelect');
          }
        },
        {
          label: '是否已配置属性',
          prop: 'isConfig',
          type: 'select',
          search: true,
          dicData: [
            {
              label: '是',
              value: true
            },
            {
              label: '否',
              value: false
            }
          ]
        },
        {
          label: '规格型号',
          prop: 'partModel'
        },
        {
          label: '更新人',
          prop: 'updateUserName'
        },
        {
          label: '更新时间',
          prop: 'updateTime'
        }
      ],
      attributeOption: {
        emptyBtn: false,
        submitBtn: false,
        detail: false,
        labelWidth: 160,
        group: [
          {
            label: '物料数据',
            arrow: false,
            prop: 'partInfo',
            labelWidth: 160,
            display: true,
            icon: 'el-icon-vertical-bar',
            column: [
              {
                label: '物料类型编码',
                prop: 'objectNo',
                span: 8,
                disabled: true
              },
              {
                label: '物料类别名称',
                prop: 'objectName',
                span: 8,
                disabled: true
              },
              {
                label: '物料类别名称',
                prop: 'partCategoryName',
                span: 8,
                disabled: true
              }
            ]
          },
          {
            label: '基础属性',
            arrow: false,
            prop: 'baseInfo',
            labelWidth: 160,
            display: true,
            icon: 'el-icon-vertical-bar',
            column: [
              {
                label: '物料类别编码',
                prop: 'objectNo',
                span: 8,
                disabled: true
              },
              {
                label: '物料类别名称',
                prop: 'objectName',
                span: 8,
                disabled: true
              },
              {
                label: '检验方式',
                prop: 'inspectionMode',
                type: 'select',
                span: 8,
                dicData: [
                  {
                    label: '免检',
                    value: 'EXEMPTION'
                  },
                  {
                    label: '抽检',
                    value: 'SAMPLING'
                  },
                  {
                    label: '全检',
                    value: 'FULLINSPECTION'
                  }
                ],
                control: (value, form) => {
                  let samplingInfo = this.findNode(this.attributeOption.group, 'samplingInfo');
                  let inspectionInfo = this.findNode(this.attributeOption.group, 'inspectionInfo');
                  if (value === 'SAMPLING') {
                    if (!this.attributeModel.minSamplingQuantity && !this.changeLock) {
                      this.attributeModel.minSamplingQuantity = 2;
                    }
                    samplingInfo.display = true;
                    inspectionInfo.display = true;
                  } else if (value === 'FULLINSPECTION') {
                    samplingInfo.display = false;
                    inspectionInfo.display = true;
                    this.resetAqlForm();
                  } else if (value === 'EXEMPTION') {
                    samplingInfo.display = false;
                    inspectionInfo.display = false;
                    this.resetAqlForm();
                  }
                  this.changeLock = false;
                },
                rules: [
                  {
                    required: true,
                    message: '请选择检验方式',
                    trigger: 'change'
                  }
                ]
              },
              {
                label: '检验负责人',
                prop: 'principalName',
                type: 'search',
                span: 8,
                disabled: true,
                appendClick: () => {
                  this.openUserCommonModal();
                }
              }
            ]
          },
          {
            label: '抽样属性',
            arrow: false,
            prop: 'samplingInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 170,
            display: true,
            column: [
              {
                label: '最低抽样数量',
                prop: 'minSamplingQuantity',
                span: 8,
                value: 2,
                labelTip: '抽样检验时，如果报检数量小于等于最低抽样检验数量，使用全检的检验方式',
                rules: [
                  {
                    required: true,
                    message: '请输入最低抽样数量',
                    trigger: 'blur'
                  },
                  {
                    required: true,
                    trigger: 'blur',
                    validator: (rule, value, callback) => {
                      if (!value) {
                        callback(new Error('请输入最低抽样数量'));
                      } else if (Number(value) < 2) {
                        callback(new Error('最低抽样数量抽检数量为2'));
                      } else if (String(value).indexOf('.') > -1) {
                        callback(new Error('最低抽样数量抽检数量为整数'));
                      } else {
                        callback();
                      }
                    }
                  }
                ],
                change: ({ value }) => {
                  if (!value) {
                    this.attributeModel.minSamplingQuantity = '';
                    this.changeLock = true;
                  }
                }
              },
              {
                label: 'AQL设置方案编码',
                prop: 'aqlSchemeCode',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openAqlConfigModal();
                },
                span: 8,
                rules: [
                  {
                    required: true,
                    message: '请选择AQL设置方案编码',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: 'AQL设置方案名称',
                prop: 'aqlSchemeName',
                disabled: true,
                span: 8
              },
              {
                label: '抽样标准',
                prop: 'samplingStandard',
                type: 'select',
                span: 8,
                disabled: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=sample_type',
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                },
                control: (val, form) => {
                  let severityCodeColumn = this.findObject(this.attributeOption.group, 'severityCode');
                  let levelTypeColumn = this.findObject(this.attributeOption.group, 'levelType');
                  let levelCodeColumn = this.findObject(this.attributeOption.group, 'levelCode');
                  if (val === 'MIL-STD-1916 C-0') {
                    severityCodeColumn.display = false;
                    levelTypeColumn.display = false;
                    levelCodeColumn.display = false;
                  } else {
                    severityCodeColumn.display = true;
                    levelTypeColumn.display = true;
                    levelCodeColumn.display = true;
                  }
                }
              },
              {
                label: '严重程度',
                prop: 'severityCode',
                type: 'select',
                disabled: true,
                span: 8,
                search: true,
                display: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=sample_plan',
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                }
              },
              {
                label: '检验水平',
                prop: 'levelType',
                type: 'select',
                display: true,
                span: 8,
                search: true,
                disabled: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=aql_inspection_level',
                // cascader: ['levelCode'],
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                },
                control: (val, form) => { }
              },
              {
                label: '检验水平代码',
                prop: 'levelCode',
                type: 'select',
                search: true,
                span: 8,
                disabled: true,
                display: true
                // props: {
                //   label: 'dictValue',
                //   value: 'dictKey'
                // }
              },
              {
                label: '质量水平代码',
                prop: 'limitCode',
                type: 'select',
                disabled: true,
                span: 8
                // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
                // props: {
                //   label: 'dictKey',
                //   value: 'dictKey'
                // },
                // dicFormatter: (data) => {
                //   return this._map(data.data, (item) => {
                //     return {
                //       ...item,
                //       dictKey: item.dictKey
                //     };
                //   });
                // }
              },
              {
                label: '严重缺陷抽样水平代码',
                prop: 'severityLimitCode',
                type: 'select',
                disabled: true,
                span: 8
                // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
                // props: {
                //   label: 'dictKey',
                //   value: 'dictKey'
                // }
              },
              {
                label: '主要缺陷抽样水平代码',
                prop: 'majorLimitCode',
                type: 'select',
                span: 8,
                disabled: true
                // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
                // props: {
                //   label: 'dictKey',
                //   value: 'dictKey'
                // }
              },
              {
                label: '次要缺陷抽样水平代码',
                prop: 'minorLimitCode',
                type: 'select',
                span: 8,
                disabled: true
                // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
                // props: {
                //   label: 'dictKey',
                //   value: 'dictKey'
                // }
              }
            ]
          },
          {
            label: '检验模版',
            arrow: false,
            prop: 'inspectionInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 0,
            display: true,
            column: [
              {
                label: '',
                width: 0,
                prop: 'inspectionTemplateInfo',
                span: 24
              }
            ]
          },
          {
            label: '已选物料类别',
            arrow: false,
            prop: 'partCategoryInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 160,
            display: true,
            column: [
              {
                labelWidth: 0,
                label: '',
                prop: 'info',
                span: 24,
                hide: true,
                formslot: true
              }
            ]
          },
          {
            label: '检验属性配置',
            arrow: false,
            prop: 'inspectionConfigInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 160,
            column: [
              {
                labelWidth: 0,
                label: '',
                prop: 'partnerInfo',
                span: 24,
                hide: true,
                formslot: true
              }
            ]
          }
        ]
      },
      partnerInspectionTemOption: {
        emptyBtn: false,
        submitBtn: false,
        column: [
          {
            label: '',
            width: 0,
            prop: 'inspectionTemplateInfo',
            span: 24
          }
        ]
      },
      transferOption: {
        calcHeight: 30,
        tip: false,
        searchShow: true,
        searchMenuPosition: 'right',
        searchLabelWidth: 130,
        height: '400px',
        dialogClickModal: false,
        border: true,
        columnBtn: false,
        viewBtn: false,
        addBtn: false,
        selection: true,
        printBtn: false,
        editBtn: false,
        delBtn: false,
        index: true,
        indexLabel: '序号',
        menu: false,
        refreshBtn: false,
        column: [
          {
            label: '物料类别编码',
            prop: 'objectNo',
            span: 8,
            disabled: true,
            search: true,
            type: 'tree',
            dicUrl: '/api/mes-admin/part-category/tree',
            props: {
              label: 'code',
              value: 'code'
            }
          },
          {
            label: '物料类别名称',
            prop: 'objectName',
            span: 8,
            disabled: true,
            search: true,
            type: 'select',
            type: 'tree',
            dicUrl: '/api/mes-admin/part-category/tree',
            props: {
              label: 'title',
              value: 'title'
            }
          },
          {
            label: '是否已配置属性',
            prop: 'isConfig',
            type: 'select',
            search: true,
            hide: true,
            dicData: [
              {
                label: '是',
                value: true
              },
              {
                label: '否',
                value: false
              }
            ]
          },
          {
            label: '检验方式',
            prop: 'inspectionMode',
            type: 'select',
            span: 8,
            dicData: [
              {
                label: '免检',
                value: 'EXEMPTION'
              },
              {
                label: '抽检',
                value: 'SAMPLING'
              },
              {
                label: '全检',
                value: 'FULLINSPECTION'
              }
            ],
            rules: [
              {
                required: true,
                message: '请选择检验方式',
                trigger: 'change'
              }
            ]
          },
          {
            label: '描述',
            prop: 'remark',
            type: 'textarea',
            maxRows: 3,
            minRows: 3,
            maxlength: 200,
            showWordLimit: true
          }
        ]
      },
      infoOption: {
        selection: false,
        editBtn: false,
        height: 270,
        border: true,
        menuWidth: 150,
        addBtn: false,
        delBtn: false,
        menu: false,
        columnBtn: false,
        refreshBtn: false,
        index: true,
        indexLabel: '序号',
        tip: false,
        column: [
          {
            label: '物料类别编码',
            prop: 'objectNo'
          },
          {
            label: '物料类别名称',
            prop: 'objectName'
          },
          {
            label: '描述',
            prop: 'remark'
          }
        ]
      },
      partnerOption: {
        selection: false,
        editBtn: false,
        height: 270,
        border: true,
        menuWidth: 300,
        addBtn: true,
        editBtn: true,
        delBtn: true,
        menu: true,
        searchShow: false,
        columnBtn: false,
        refreshBtn: false,
        index: true,
        indexLabel: '序号',
        labelWidth: 160,
        tip: false,
        column: [
          {
            label: '物料编码',
            prop: 'objectNo',
            span: 8,
            hide: true,
            disabled: true
          },
          {
            label: '物料名称',
            prop: 'objectName',
            span: 8,
            hide: true,
            disabled: true
          },
          {
            label: '供应商代码',
            prop: 'vendorCode',
            span: 8,
            type: 'search',
            disabled: true,
            appendClick: () => {
              this.openPartnerModal();
            },
            rules: [
              {
                required: true,
                message: '请选择供应商代码',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '供应商名称',
            prop: 'vendorName',
            disabled: true,
            span: 8
          },
          {
            label: '检验方式',
            prop: 'inspectionMode',
            type: 'select',
            span: 8,
            dicData: [
              {
                label: '免检',
                value: 'EXEMPTION'
              },
              {
                label: '抽检',
                value: 'SAMPLING'
              },
              {
                label: '全检',
                value: 'FULLINSPECTION'
              }
            ],
            control: (val, form) => {
              if (val === 'EXEMPTION' || val === 'FULLINSPECTION') {
                this.resetPartnerAqlForm();
                return {
                  aqlSchemeCode: {
                    display: false
                  },
                  aqlSchemeName: {
                    display: false
                  },
                  samplingStandard: {
                    display: false
                  },
                  severityCode: {
                    display: false
                  },
                  levelType: {
                    display: false
                  },
                  levelCode: {
                    display: false
                  },
                  limitCode: {
                    display: false
                  },
                  severityLimitCode: {
                    display: false
                  },
                  majorLimitCode: {
                    display: false
                  },
                  minorLimitCode: {
                    display: false
                  }
                };
              } else if (val === 'SAMPLING') {
                return {
                  aqlSchemeCode: {
                    display: true
                  },
                  aqlSchemeName: {
                    display: true
                  },
                  samplingStandard: {
                    display: true
                  },
                  severityCode: {
                    display: true
                  },
                  levelType: {
                    display: true
                  },
                  levelCode: {
                    display: true
                  },
                  limitCode: {
                    display: true
                  },
                  severityLimitCode: {
                    display: true
                  },
                  majorLimitCode: {
                    display: true
                  },
                  minorLimitCode: {
                    display: true
                  }
                };
              }

              let levelType = this.findObject(this.partnerOption.column, 'levelType');
              console.log(levelType, 8888888);
            },
            rules: [
              {
                required: true,
                message: '请选择检验方式',
                trigger: 'change'
              }
            ]
          },
          {
            label: 'AQL设置方案编码',
            prop: 'aqlSchemeCode',
            disabled: true,
            span: 8,
            type: 'search',
            appendClick: () => {
              this.openAqlConfigModal('partnerSelect');
            },
            rules: [
              {
                required: true,
                message: '请选择AQL设置方案编码',
                trigger: 'blur'
              }
            ]
          },
          {
            label: 'AQL设置方案名称',
            prop: 'aqlSchemeName',
            span: 8,
            disabled: true
          },
          {
            label: '抽样标准',
            prop: 'samplingStandard',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true,
            dicUrl: '/api/blade-system/dict/dictionary?code=sample_type',
            props: {
              label: 'dictValue',
              value: 'dictKey'
            },
            control: (val, form) => {
              if (val === 'MIL-STD-1916 C-0') {
                return {
                  severityCode: {
                    display: false
                  },
                  levelType: {
                    display: false
                  },
                  levelCode: {
                    display: false
                  }
                };
              } else if (val === 'GB/2828') {
                return {
                  severityCode: {
                    display: true
                  },
                  levelType: {
                    display: true
                  },
                  levelCode: {
                    display: true
                  }
                };
              }
            }
          },
          {
            label: '严重程度',
            prop: 'severityCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true,
            display: true,
            dicUrl: '/api/blade-system/dict/dictionary?code=sample_plan',
            props: {
              label: 'dictValue',
              value: 'dictKey'
            }
          },
          {
            label: '检验水平',
            prop: 'levelType',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true,
            display: true,
            dicUrl: '/api/blade-system/dict/dictionary?code=aql_inspection_level',
            // cascader: ['levelCode'],
            props: {
              label: 'dictValue',
              value: 'dictKey'
            },
            control: (val, form) => { }
          },
          {
            label: '检验水平代码',
            prop: 'levelCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true,
            display: true,
            props: {
              label: 'dictValue',
              value: 'dictKey'
            }
          },
          {
            label: '质量水平代码',
            prop: 'limitCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true,
            display: true
            // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
            // props: {
            //   label: 'dictKey',
            //   value: 'dictKey'
            // },
            // dicFormatter: (data) => {
            //   return this._map(data.data, (item) => {
            //     return {
            //       ...item,
            //       dictKey: item.dictKey
            //     };
            //   });
            // }
          },
          {
            label: '严重缺陷抽样水平代码',
            prop: 'severityLimitCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true
            // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
            // props: {
            //   label: 'dictKey',
            //   value: 'dictKey'
            // }
          },
          {
            label: '主要缺陷抽样水平代码',
            prop: 'majorLimitCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true
            // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
            // props: {
            //   label: 'dictKey',
            //   value: 'dictKey'
            // }
          },
          {
            label: '次要缺陷抽样水平代码',
            prop: 'minorLimitCode',
            type: 'select',
            span: 8,
            hide: true,
            disabled: true
            // dicUrl: '/api/blade-system/dict/dictionary?code=sample_code',
            // props: {
            //   label: 'dictKey',
            //   value: 'dictKey'
            // }
          }
        ]
      },
      templateOption: {
        emptyBtn: false,
        submitBtn: false,
        detail: false,
        labelWidth: 120,
        column: [
          {
            label: '检验模板',
            prop: 'inspectionTemplateName',
            span: 24
          }
        ]
      },
      tableOptionCopy: {
        modalTitle: '选择检验模板（双击进行选择）',
        isPage: true,
        selection: true,
        rowSelectionType: 'single',
        columnDefs: [
          {
            label: '检验模板名称',
            prop: 'name',
            searchLabelWidth: 120,
            search: true
          },
          {
            label: '检验模板编码',
            prop: 'code',
            searchLabelWidth: 120,
            search: true
          },
          {
            label: '检验模板类型',
            prop: 'type',
            type: 'select',
            dicUrl: '/api/blade-system/dict/dictionary?code=QC',
            props: {
              label: 'dictValue',
              value: 'dictKey'
            }
          },
          {
            label: '创建时间',
            prop: 'createTime'
          },
          {
            label: '最后更改时间',
            prop: 'updateTime'
          }
        ]
      },
      inspectionItemOption: {
        emptyBtn: false,
        submitBtn: false,
        label: '基本信息',
        icon: 'el-icon-vertical-bar',
        arrow: false,
        border: true,
        menu: false,
        addBtn: false,
        columnBtn: false,
        refreshBtn: false,
        indexLabel: '序号',
        index: true,
        // highlightCurrentRow: true, // 选中高亮
        column: [
          {
            label: '检验项明细',
            prop: 'attributeName',
            labelWidth: 100,
            maxlength: 50,
            span: 8,
            disabled: true,
            type: 'input',
            rules: [
              {
                required: true,
                message: '请输入检验项明细',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '明细项编码',
            prop: 'code',
            labelWidth: 100,
            span: 8,
            maxlength: 50,
            type: 'input',
            disabled: true,
            rules: [
              {
                required: true,
                message: '请输入明细项编码',
                trigger: 'blur'
              }
            ]
          },
          {
            label: '检验类型',
            span: 8,
            type: 'select',
            prop: 'testType',
            disabled: true,
            dicData: [
              {
                label: '正常',
                value: 'NORMAL'
              },
              {
                label: '主要',
                value: 'MAJOR'
              },
              {
                label: '次要',
                value: 'MINOR'
              }
            ]
          },
          {
            label: '检验标准',
            prop: 'testCriterion',
            span: 8,
            maxlength: 15
            // type: 'input',
            // blur: ({ value }) => {
            //   this._forEach(this.attributeData, (item) => {
            //     console.log(item.id === this.attributeModel.id, 9999);
            //     if (item.id === this.attributeModel.id) {
            //       item.testCriterion = value;
            //     }
            //   });
            // }
          },
          {
            label: '单位',
            prop: 'unit',
            span: 8,
            disabled: true
          },
          {
            label: '质量因素',
            span: 8,
            prop: 'operationType',
            type: 'select',
            disabled: true,
            dicData: [
              {
                label: '人员',
                value: 'PERSONNEL'
              },
              {
                label: '机器',
                value: 'MACHINE'
              },
              {
                label: '材料',
                value: 'MATERIAL'
              },
              {
                label: '方法',
                value: 'METHOD'
              },
              {
                label: '测量',
                value: 'MEASURE'
              },
              {
                label: '环境',
                value: 'ENVIRONMENT'
              }
            ]
          },
          {
            label: '检验方式',
            span: 8,
            prop: 'testRecordType',
            type: 'select',
            disabled: true,
            dicData: [
              {
                label: '检验',
                value: 'INSPECTION'
              },
              {
                label: '测试',
                value: 'TEST'
              }
            ]
          },
          {
            label: '检验工具',
            span: 8,
            prop: 'testTool',
            maxlength: 50,
            disabled: true
          },
          {
            label: '备注/原因',
            prop: 'remark',
            span: 24,
            type: 'textarea',
            maxRows: 3,
            minRows: 3,
            maxlength: 50,
            disabled: true
          },
          {
            label: '',
            span: 24,
            labelWidth: 0,
            formslot: true,
            hide: true,
            prop: 'controlType'
          }
        ]
      },
      globalConfigOption: {
        emptyBtn: false,
        submitBtn: false,
        detail: false,
        labelWidth: 160,
        group: [
          {
            label: '基础属性',
            arrow: false,
            prop: 'baseInfo',
            labelWidth: 160,
            display: true,
            icon: 'el-icon-vertical-bar',
            column: [
              {
                label: '检验方式',
                prop: 'inspectionMode',
                type: 'select',
                span: 8,
                row: true,
                dicData: [
                  {
                    label: '免检',
                    value: 'EXEMPTION'
                  },
                  {
                    label: '抽检',
                    value: 'SAMPLING'
                  },
                  {
                    label: '全检',
                    value: 'FULLINSPECTION'
                  }
                ],
                control: (value, form) => {
                  let samplingInfo = this.findNode(this.globalConfigOption.group, 'samplingInfo');
                  let inspectionInfo = this.findNode(this.globalConfigOption.group, 'inspectionInfo');
                  if (value === 'SAMPLING') {
                    if (!this.globalConfigModel.minSamplingQuantity && !this.changeLock) {
                      this.globalConfigModel.minSamplingQuantity = 2;
                    }
                    samplingInfo.display = true;
                    inspectionInfo.display = true;
                  } else if (value === 'FULLINSPECTION') {
                    samplingInfo.display = false;
                    inspectionInfo.display = true;
                    this.resetGlobalAqlForm();
                  } else if (value === 'EXEMPTION') {
                    samplingInfo.display = false;
                    inspectionInfo.display = false;
                    this.resetGlobalAqlForm();
                  }
                  this.changeLock = false;
                },
                rules: [
                  {
                    required: true,
                    message: '请选择检验方式',
                    trigger: 'change'
                  }
                ]
              },
            ]
          },
          {
            label: '抽样属性',
            arrow: false,
            prop: 'samplingInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 170,
            display: false,
            column: [
              {
                label: '最低抽样数量',
                prop: 'minSamplingQuantity',
                span: 8,
                value: 2,
                labelTip: '抽样检验时，如果报检数量小于等于最低抽样检验数量，使用全检的检验方式',
                rules: [
                  {
                    required: true,
                    message: '请输入最低抽样数量',
                    trigger: 'blur'
                  },
                  {
                    required: true,
                    trigger: 'blur',
                    validator: (rule, value, callback) => {
                      if (!value) {
                        callback(new Error('请输入最低抽样数量'));
                      } else if (Number(value) < 2) {
                        callback(new Error('最低抽样数量抽检数量为2'));
                      } else if (String(value).indexOf('.') > -1) {
                        callback(new Error('最低抽样数量抽检数量为整数'));
                      } else {
                        callback();
                      }
                    }
                  }
                ],
                change: ({ value }) => {
                  if (!value) {
                    this.globalConfigModel.minSamplingQuantity = '';
                    this.changeLock = true;
                  }
                }
              },
              {
                label: 'AQL设置方案编码',
                prop: 'aqlSchemeCode',
                type: 'search',
                disabled: true,
                appendClick: () => {
                  this.openAqlConfigModal('globalConfig');
                },
                span: 8,
                rules: [
                  {
                    required: true,
                    message: '请选择AQL设置方案编码',
                    trigger: 'blur'
                  }
                ]
              },
              {
                label: 'AQL设置方案名称',
                prop: 'aqlSchemeName',
                disabled: true,
                span: 8
              },
              {
                label: '抽样标准',
                prop: 'samplingStandard',
                type: 'select',
                span: 8,
                disabled: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=sample_type',
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                },
                control: (val, form) => {
                  let severityCodeColumn = this.findObject(this.globalConfigOption.group, 'severityCode');
                  let levelTypeColumn = this.findObject(this.globalConfigOption.group, 'levelType');
                  let levelCodeColumn = this.findObject(this.globalConfigOption.group, 'levelCode');
                  if (val === 'MIL-STD-1916 C-0') {
                    severityCodeColumn.display = false;
                    levelTypeColumn.display = false;
                    levelCodeColumn.display = false;
                  } else {
                    severityCodeColumn.display = true;
                    levelTypeColumn.display = true;
                    levelCodeColumn.display = true;
                  }
                }
              },
              {
                label: '严重程度',
                prop: 'severityCode',
                type: 'select',
                disabled: true,
                span: 8,
                search: true,
                display: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=sample_plan',
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                }
              },
              {
                label: '检验水平',
                prop: 'levelType',
                type: 'select',
                display: true,
                span: 8,
                search: true,
                disabled: true,
                dicUrl: '/api/blade-system/dict/dictionary?code=aql_inspection_level',
                props: {
                  label: 'dictValue',
                  value: 'dictKey'
                },
                control: (val, form) => { }
              },
              {
                label: '检验水平代码',
                prop: 'levelCode',
                type: 'select',
                search: true,
                span: 8,
                disabled: true,
                display: true
              },
              {
                label: '质量水平代码',
                prop: 'limitCode',
                type: 'select',
                disabled: true,
                span: 8
              },
              {
                label: '严重缺陷抽样水平代码',
                prop: 'severityLimitCode',
                type: 'select',
                disabled: true,
                span: 8
              },
              {
                label: '主要缺陷抽样水平代码',
                prop: 'majorLimitCode',
                type: 'select',
                span: 8,
                disabled: true
              },
              {
                label: '次要缺陷抽样水平代码',
                prop: 'minorLimitCode',
                type: 'select',
                span: 8,
                disabled: true
              }
            ],
          },
          {
            label: '检验模版',
            arrow: false,
            prop: 'inspectionInfo',
            icon: 'el-icon-vertical-bar',
            labelWidth: 0,
            display: false,
            column: [
              {
                label: '',
                width: 0,
                prop: 'inspectionTemplateInfo',
                span: 24
              }
            ]
          },
        ]
      }
    };
  }
};

export default mixinFromInspectionAttributes;
